
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>spkw08_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>spkw08_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   void spkw08_c ( SpiceInt            handle,
                   SpiceInt            body,
                   SpiceInt            center,
                   ConstSpiceChar    * frame,
                   SpiceDouble         first,
                   SpiceDouble         last,
                   ConstSpiceChar    * segid,
                   SpiceInt            degree,
                   SpiceInt            n,
                   ConstSpiceDouble    states[][6],
                   SpiceDouble         epoch1,
                   SpiceDouble         step           )

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
 
   Write a type 8 segment to an SPK file. 
 </PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
 
   <a href="../req/naif_ids.html">NAIF_IDS</a> 
   <a href="../req/spc.html">SPC</a> 
   <a href="../req/spk.html">SPK</a> 
   <a href="../req/time.html">TIME</a> 
 </PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
 
   EPHEMERIS 
   FILES 
 

</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
 
   Variable  I/O  Description 
   --------  ---  -------------------------------------------------- 
   handle     I   Handle of an SPK file open for writing. 
   body       I   NAIF code for an ephemeris object. 
   center     I   NAIF code for center of motion of BODY. 
   frame      I   Reference frame name. 
   first      I   Start time of interval covered by segment. 
   last       I   End time of interval covered by segment. 
   segid      I   Segment identifier. 
   degree     I   Degree of interpolating polynomials. 
   n          I   Number of states. 
   states     I   Array of states. 
   epoch1     I   Epoch of first state in states array. 
   step       I   Time step separating epochs of states. 
   MAXDEG     P   Maximum allowed degree of interpolating polynomial. 
 </PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
 
   handle         is the file handle of an SPK file that has been 
                  opened for writing. 
 
   body           is the NAIF integer code for an ephemeris object 
                  whose state relative to another body is described 
                  by the segment to be created. 
 
   center         is the NAIF integer code for the center of motion 
                  of the object identified by body. 
 
   frame          is the NAIF name for a reference frame 
                  relative to which the state information for body 
                  is specified. 
 
   first, 
   last           are, respectively, the start and stop times of 
                  the time interval over which the segment defines 
                  the state of body. 
 
   segid          is the segment identifier.  An SPK segment 
                  identifier may contain up to 40 characters. 
 
   degree         is the degree of the Lagrange polynomials used to 
                  interpolate the states.  All components of the 
                  state vectors are interpolated by polynomials of 
                  fixed degree. 
 
   n              is the number of states in the input state vector 
                  array. 
 
   states         contains a time-ordered array of geometric states 
                  ( x, y, z, dx/dt, dy/dt, dz/dt, in kilometers and 
                  kilometers per second ) of body relative to center, 
                  specified relative to frame. 
 
   epoch1         is the epoch corresponding to the first state in 
                  the state array.  Because extra states are needed 
                  at the beginning and end of the segment in order 
                  for the interpolation method to work, epoch1 will 
                  normally precede first. 
 
   step           is the time step separating the epochs of adjacent 
                  states in the input state array.  step is specified 
                  in seconds. 
 </PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
 
   None.  See $Particulars for a description of the effect of this 
   routine. 
 </PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
 
   MAXDEG         is the maximum allowed degree of the interpolating 
                  polynomial.  If the value of MAXDEG is increased, 
                  the CSPICE routine SPKPV must be changed 
                  accordingly.  In particular, the size of the 
                  record passed to SPKRnn and SPKEnn must be 
                  increased, and comments describing the record size 
                  must be changed. 
 
                  The current value of MAXDEG is 15.
  </PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
 
   If any of the following exceptions occur, this routine will return 
   without creating a new segment. 
 
   1)  If FRAME is not a recognized name, the error 
       SPICE(INVALIDREFFRAME) is signaled. 
 
   2)  If the last non-blank character of SEGID occurs past index 40, 
       the error SPICE(SEGIDTOOLONG) is signaled. 
 
   3)  If SEGID contains any nonprintable characters, the error 
       SPICE(NONPRINTABLECHARS) is signaled. 
 
   4)  If DEGREE is not at least 1 or is greater than MAXDEG, the 
       error SPICE(INVALIDDEGREE) is signaled. 
 
   5)  If the number of states N is not at least DEGREE+1, the error 
       SPICE(TOOFEWSTATES) will be signaled. 
 
   6)  If FIRST is greater than LAST then the error 
       SPICE(BADDESCRTIMES) will be signaled. 
 
   7)  If STEP is non-positive, the error SPICE(INVALIDSTEPSIZE) will 
       be signaled. 
 
   8)  If the first epoch EPOCH1 is greater than FIRST, the error 
       SPICE(BADDESCRTIMES) will be signaled. 
 
   9)  If the last epoch 
 
          FIRST + (N-1)*STEP 
 
       is less than LAST, the error SPICE(BADDESCRTIMES) will be 
       signaled. 
 
   10) The error SPICE(EMPTYSTRING) is signaled if either input
       string does not contain at least one character, since the
       input strings cannot be converted to a Fortran-style string
       in this case.
      
   11) The error SPICE(NULLPOINTER) is signaled if either input string
       pointer is null.
</PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
 
   A new type 8 SPK segment is written to the SPK file attached 
   to handle. 
 </PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
 
   This routine writes an SPK type 08 data segment to the open SPK 
   file according to the format described in the type 08 section of 
   the SPK Required Reading. The SPK file must have been opened with 
   write access. 
 </PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
 
   Suppose that you have states and are prepared to produce 
   a segment of type 08 in an SPK file. 
 
   The following code fragment could be used to add the new segment 
   to a previously opened SPK file attached to HANDLE. The file must 
   have been opened with write access. 
 
      #include &quot;SpiceUsr.h&quot;
           .
           .
           .
           
      /.
      First open the SPK file and get a handle for it. 
      ./
      <a href="spkopa_c.html">spkopa_c</a> ( spknam, &amp;handle ); 

      /.
      Create a segment identifier. 
      ./
      segid = &quot;MY_SAMPLE_SPK_TYPE_8_SEGMENT&quot;;

      /.
      Write the segment. 
      ./
      <b>spkw08_c</b> (  handle,  body,    center,  frame, 
                  first,   last,    segid,   degree, 
                  n,       states,  epoch1,  step     );
 
      /.
      Close the file. 
      ./
      <a href="spkcls_c.html">spkcls_c</a> ( handle );
      
      </PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
 
   K.R. Gehringer (JPL) 
   N.J. Bachman   (JPL) 
   J.M. Lynch     (JPL) 
   W.L. Taber     (JPL) 
 </PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
 
   -CSPICE Version 1.0.0, 29-JUN-1999 (NJB)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
 
   write spk type_8 ephemeris data segment 
 </PRE>
<h4>Link to routine spkw08_c source file <a href='../../../src/cspice/spkw08_c.c'>spkw08_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:30 2010</pre>

</body>
</html>

